﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<TPOJ.Model.Contest>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	AddContestProblem
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2><%= Html.Encode(Model.Title) %></h2>
    <p><%= Html.Encode(Model.Description) %></p>
    <div class="facts">
            <table>
                <tr>
                    <td>
                        <b>Start Time:</b>
                        <span id="start"><%= Html.Encode(String.Format("{0:g}", Model.StartTime)) %></span>
                    </td>
                    <td class="span">
                    </td>
                    <td>
                        <b>End Time:</b>
                        <span id="end"><%= Html.Encode(String.Format("{0:g}", Model.EndTime)) %></span>
                    </td>
                </tr>
            </table>
        </div>
    
    <br />

    <% using (Html.BeginForm("AddContestProblem", "Contest")){ %>
    <%= Html.HiddenFor(model => model.UniqueID)%>
            Problem ID:<%= Html.TextBox("pid", null, new { maxlength = "4", size = "6" })%><input type="submit" value="add" />
    <% } %>

    <br />

            <table>
            <tr>
            <th></th>
            <th>
                ID
            </th>
            <th>
                Title
            </th>
            <th>
                Delete
            </th>
        </tr>
            <% int i = -1; %>
            <% foreach (var item in Model.Problems.OrderBy(p=>p.UniqueID)) { %>
            <% i++; %>
            <tr>
                <td><%= Html.Encode(Convert.ToChar('A' + i)) %></td>
                <td>
                    <%= Html.Encode(item.UniqueID) %>
                </td>
                <td>
                   <%= Html.ActionLink(item.Title, "Details", "Problem", new { id = item.UniqueID, contestId = Model.UniqueID }, new { target = "_blank" })%>
                </td>
                <td>
                    <%= Html.ActionLink("Delete", "DeleteContestProblem", new { cid = Model.UniqueID, pid = item.UniqueID }) %>
                </td>
        </tr>
    
    <% } %>

    </table>

    <p>

        <%=Html.ActionLink("Edit", "Edit", new { id=Model.UniqueID }) %> |
        <%=Html.ActionLink("Back to List", "Index") %>
    </p>

</asp:Content>

